package bg.btanev.eightyfour.shared.command;

import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 *
 * @author B.Tanev
 *
 * @param <CI>
 * @param <CR>
 */
public class CommandResult<CI extends CommandInput, CR extends Serializable> implements IsSerializable {
	/**
	 *
	 */
	private static final long serialVersionUID = 4137725169938965917L;

	/*
	 * HACK ALERT!!!
	 *
	 * the field types _MUST_ non generic because the GWT compiler "sometimes" gets confused and refuses to serialize an
	 * object!
	 */
	private CommandInput input;
	private Serializable result;

	public CommandResult() {
		super();
	}

	public CommandResult(CommandInput input, Serializable result) {
		super();
		this.input = input;
		this.result = result;
	}

	@SuppressWarnings("unchecked")
	public CI getInput() {
		return (CI) input;
	}

	@SuppressWarnings("unchecked")
	public CR getResult() {
		return (CR) result;
	}

	public void setInput(CI input) {
		this.input = input;
	}

	public void setResult(CR result) {
		this.result = result;
	}

	@Override
	public String toString() {
		return "CommandResult [input=" + input + ", result=" + result + "]";
	}

}
